45. Implementing HTML Escaping
Implementing HTML Escaping
Question:
Start Quiz:
# User Instructions
#
# Implement the function escape_html(s), which replaces
# all instances of:
# > with >
# < with <
# " with "
# & with &
# and returns the escaped string
# Note that your browser will probably automatically
# render your escaped text as the corresponding symbols,
# but the grading script will still correctly evaluate it.
#
def escape_html(s):
# print escape_html('>')
# print escape_html('<')
# print escape_html('"')
# print escape_html("&")
Solution:
INSTRUCTOR NOTE:
There is a mistake in this solution, the ""e;" on line 12 should instead be """